load("//bazel:skia_rules.bzl", "skia_cc_library", "split_srcs_and_hdrs")

package(
    default_applicable_licenses = ["//:license"],
)

licenses(["notice"])

VULKAN_FILES = [
    "VulkanBackendSemaphore.cpp",
    "VulkanBackendTexture.cpp",
    "VulkanBuffer.cpp",
    "VulkanBuffer.h",
    "VulkanCaps.cpp",
    "VulkanCaps.h",
    "VulkanCommandBuffer.cpp",
    "VulkanCommandBuffer.h",
    "VulkanDescriptorPool.cpp",
    "VulkanDescriptorPool.h",
    "VulkanDescriptorSet.cpp",
    "VulkanDescriptorSet.h",
    "VulkanFramebuffer.cpp",
    "VulkanFramebuffer.h",
    "VulkanGraphicsPipeline.cpp",
    "VulkanGraphicsPipeline.h",
    "VulkanGraphiteUtils.cpp",
    "VulkanGraphiteUtils.h",
    "VulkanImageView.cpp",
    "VulkanImageView.h",
    "VulkanQueueManager.cpp",
    "VulkanQueueManager.h",
    "VulkanRenderPass.cpp",
    "VulkanRenderPass.h",
    "VulkanResourceProvider.cpp",
    "VulkanResourceProvider.h",
    "VulkanSampler.cpp",
    "VulkanSampler.h",
    "VulkanSharedContext.cpp",
    "VulkanSharedContext.h",
    "VulkanTexture.cpp",
    "VulkanTexture.h",
    "VulkanTextureInfo.cpp",
    "VulkanYcbcrConversion.cpp",
    "VulkanYcbcrConversion.h",
]

split_srcs_and_hdrs(
    name = "vk",
    files = VULKAN_FILES,
)

skia_cc_library(
    name = "graphite_native_vulkan",
    srcs = [
        ":vk_hdrs",
        ":vk_srcs",
    ],
    hdrs = [
        "//include/gpu:shared_gpu_hdrs",
        "//include/gpu/graphite:public_hdrs",
        "//include/gpu/graphite/vk:public_hdrs",
    ],
    defines = ["SK_VULKAN"],
    implementation_deps = [
        "//include/third_party/vulkan",
    ],
    local_defines = ["SK_USE_INTERNAL_VULKAN_HEADERS"],
    visibility = ["//:__pkg__"],
    deps = [
        "//:core",
        "//src/base",
        "//src/core:core_priv",
        "//src/gpu",
        "//src/gpu/graphite",
        "//src/gpu/vk",
    ],
)

skia_cc_library(
    name = "graphite_native_vulkan_TEST_UTIL",
    testonly = True,
    srcs = [
        ":vk_hdrs",
        ":vk_srcs",
    ],
    hdrs = [
        "//include/gpu:shared_gpu_hdrs",
        "//include/gpu/graphite:public_hdrs",
        "//include/gpu/graphite/vk:public_hdrs",
    ],
    defines = [
        "SK_VULKAN",
        "GPU_TEST_UTILS",
    ],
    implementation_deps = [
        "//include/third_party/vulkan",
    ],
    local_defines = ["SK_USE_INTERNAL_VULKAN_HEADERS"],
    visibility = ["//tools:__pkg__"],
    deps = [
        "//:core",
        "//src/base",
        "//src/core:core_priv",
        "//src/gpu",
        "//src/gpu/graphite:graphite_TEST_UTIL",
        "//src/gpu/vk",
    ],
)
